package com.sihan.framework.etm.service;

import com.framework.model.ApiResult;
import com.framework.model.PageResult;
import com.framework.mybatis.service.BaseService;
import com.sihan.framework.etm.common.PageRequest;
import com.sihan.framework.etm.dto.*;
import com.sihan.framework.etm.dto.business.DeviceMountDTO;
import com.sihan.framework.etm.entity.EtmDeviceRecord;
import com.sihan.framework.etm.entity.baseData.DeviceModel;
import com.sihan.framework.etm.entity.baseData.EtmDeviceMount;
import com.sihan.framework.etm.entity.business.CollectionRecord;
import com.sihan.framework.etm.vo.baseData.DeviceVO;

import javax.xml.crypto.Data;
import java.net.BindException;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * (EtmDeviceMount)表服务接口
 *
 * @author makejava
 * @since 2022-05-20 16:04:48
 */
public interface EtmDeviceMountService extends BaseService<EtmDeviceMount, String> {


    /**
     * 根据 record 与 device 做工器具状态 做记录
     *
     * @param record
     * @param device
     */
    void insertDeviceMount(EtmDeviceRecord record, DeviceModel device, Date date);

    /**
     * @param orgId 登录用户orgId
     * @return
     */
    Map<String, Integer> getDevState(String orgId);


    Map<String, Integer> getDevStateMap();

    /**
     * @return
     */
    List<DeviceMountDTO> usingAstate(String id);

    /**
     * 使用次数
     *
     * @param id
     * @return
     */
    List<DeviceMountDTO> mountTheAbnormal(String id);

    /**
     * @param deviceId
     * @param startTime
     * @param endTime
     * @return
     */
    List<EtmDeviceMount> getEtmDeviceMountList(String deviceId,
                                               Data startTime,
                                               Data endTime,
                                               String orgId);

    /**
     * @return
     */
    PageResult<EtmDeviceMountDTO> pageDeviceOneMount(MountDTO dto);


    PageResult<EtmDeviceMountDTO> DeviceOneMount(MountDTO dto,int pageNum,int pageSize);

    PageResult<EtmDeviceMountDTO> pageDeviceAllMount(PageRequest pageRequest,
                                                     String deviceName,
                                                     String deviceCode,
                                                     Integer mountType,
                                                     Integer mountState,
                                                     Integer Integer);

    PageResult<GetAllDeviceAlarmDTO> pageTheCurrentDeviceAllMount(PageRequest pageRequest,
                                                                  String deviceName,
                                                                  String deviceCode,
                                                                  String deviceType,
                                                                  String taskCode)throws BindException;

    /**
     * 分页获取所有设备的电量异常
     *
     * @param pageRequest
     * @param deviceCode
     * @param deviceName
     * @return
     */
    PageResult<DeviceRecordDTO> pageGetAllDevAbnormalElectricQuantity(PageRequest pageRequest,
                                                                      String deviceName,
                                                                      String deviceCode,
                                                                      String typeId);

    /**
     * 分页获取单个设备的电量异常
     *
     * @param pageRequest
     * @param deviceId
     * @return
     */
    PageResult<DeviceRecordDTO> pageGetOneDevAbnormalElectricQuantity(PageRequest pageRequest,
                                                                      String deviceId);

    /**
     * @param pageRequest
     * @param devCode
     * @param devName
     * @param orgId
     * @return
     */
    PageResult<DeviceVO> pagegetDevList(PageRequest pageRequest,
                                        String devCode,
                                        String devName,
                                        String orgId);

    /**
     * 分页获取领用记录
     *
     * @param pageRequest
     * @param devCode
     * @param devName
     * @return
     */
    PageResult<CollectionRecord> getCollectionRecord(PageRequest pageRequest,Integer pageNum,Integer pageSize,
                                                     String devCode,
                                                     String devName,
                                                     String taskCode,
                                                     Integer typeId,
                                                     Integer state);

    PageResult<CollectionRecord> wxGetCollectionRecord(Integer pageNum,Integer pageSize,
                                                       String devCode,
                                                       String state,
                                                       String currentState);

    /**
     * 根据设备id获取设备领用记录
     *
     * @param pageRequest
     * @param startTheReturn
     * @param endTheReturn
     * @param deviceId
     * @param state
     * @return
     */
    PageResult<GetByIdRecordDTO> getByIdRecord(PageRequest pageRequest, String startTheReturn, String endTheReturn,
                                               String deviceId,
                                               String taskCode,
                                               Integer state);
    ApiResult<?> giveBack( String deviceId,String ticketCode);


}